package com.exercise.dao.impl;

import java.io.Serializable;

import javax.annotation.Resource;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.springframework.stereotype.Repository;

import com.exercise.dao.UserDao;
import com.exercise.model.User;


@Repository("userDao")
public class UserDaoImpl implements UserDao{

	@Resource
	private SessionFactory sessionFactory;
	




	@Override
	public int saveUser(User user) {
		
		Session session=sessionFactory.getCurrentSession();
		
		Serializable result=session.save(user);
		
		System.out.println((Integer)result);
		if ((Integer)result > 0) {
			return 1;
		}else {
			return 0;
		}
		
	}

}
